# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /cvs/zport/sci-libs/zchaff/zchaff-2004.11.15.ebuild,v 1.1.1.1 2006/11/22 16:05:34 zechs Exp $

inherit eutils

DESCRIPTION="zChaff - A SAT solver"
HOMEPAGE="http://www.princeton.edu/~chaff/"
SRC_URI="http://www.ee.princeton.edu/~chaff/zchaff/${PN}.${PV}.zip"

LICENSE="as-is"
SLOT="0"
KEYWORDS="x86 sparc"

IUSE="dynamic"
DEPEND="virtual/libc"

S=${WORKDIR}/${PN}

src_unpack() {
	unpack ${A}
	cd ${S} || die
	epatch ${FILESDIR}/${P}-dynamic.diff
	epatch ${FILESDIR}/${P}-header.diff
}

src_compile() {
	make || die
}

src_install() {
	install -d ${D}usr/lib/${PN} ${D}usr/include/${PN}

	make PREFIX=${D}/usr install-static || die
	make PREFIX=${D}/usr install-headers || die

	if use dynamic; then
		make PREFIX=${D}/usr install-dynamic || die
		echo ${FILESDIR}/99${PN}
		insinto /etc/env.d
		doins ${FILESDIR}/99${PN}
	fi
}

